package com.pay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
    //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "9021000136671673";

    // 商户私钥，您的PKCS8格式RSA2私钥 对应支付宝中：应用私钥:
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCc51kt/UlAukckVbAfwifeh2kfT7QCa+oZH0qzaXpiuR8c1OFATTh2+PB9VRO4Y5OJZF56o9bUgw1VMqEoDa71PCAccpz3ukVDRiifZBSHLmD9Kx9YKlg0vE9oixfduJUVuMxphSlC1nM6YnJnp7Xqv8pYr/C5sjyXs6/8hge1pkKD4+i7IrYi83BjYRVFDd2/bpg/BGaupXByZ8qiEfReRimOMuAnblGNXsO9qaHzyzNOrrhb1XK+x3khb+GrhREjGE/G3IVERSjSgX8yYGbkuOfFbtNTZ7VmnJover2IANM6xd1k0iMgXep8mUd04YKQ0oajnwVKZJtFnaxr0FXXAgMBAAECggEAJDL70DBvhg9z+l4KlEknCaAUELVCwoxDJiiiA2KCaeRr2SsEDOHD9S7ZzRCjzBatIzWU1paWKdFSciWMKMF/a/TDM8z9ienfsPWuyZc9ZTK+Daq1QJIEZ6ZKa8QrbWv4eVp5Tp76NgFj9ERiQKfgwJgfBvcQgscsU5ORNqF1heLJTGjRjVe4SlTaEMCoXjTt5J091nU1L+VVAQBY4VEJgtgqtEXQuSD77rarMH60kjZJnw6R/vI45QyFus2lqQtmHoMgpOETz48tKMQk0OPs70xODEQVViUveBSgu8lKV6BQ+4SARi3YgGS9bTD/BsOX8BN5LUdLN+xxWy02+4kIgQKBgQDPrYl0zKjADEym/AW0oZFi7kr2U/FcqHrHcYHeSXx9/82XjnNe6SDvzWK40Uj3fSeY+8bJcG+M0bzyIUKRluyuxfGQIVA2L11QHZrIaqe7fk6/0u6hqcTfTsla20gNWVN4NX5YuosCz3diLc0Yz1hhlK9N+ZTjkLu0Ku6zs8W41QKBgQDBaWp4brnMVdHJCbcO2KDYqFDUyOO0mrZcgKwN6M4q/kX0H/nvPxYIW7UrlLWkfPTxdoapnH6wKiw1EKUK40YLghun8V7r6/MCSmppfRN1KmOzC2MuPRkf0vKFwXi/VlGlUU8stoAJlxw1G+UrQ7JT2hT6WDhPypjDN2xLMfIp+wKBgANWOXgr9aYoTG7+a6UMV4asZ33vuVgQyPA9baXBroNjwczmmAn1WvcfaK+phS+czi8SFI6WBOTRVeTaDfTC5Qil24zCTESinDA2WY9Qz2Me02sXm4fzb1tbK7cPAOheAA5VZbNNRACGjtd//uSgKD5hIjPxh6fkYm+xpOY0REAFAoGAMYzmQBBt/VGHO3AHu//3xUnp23nUDHMOgUhdy/p2x0D5fv+qMocBCAcmtRGWL5vrzOjGuzFiq5NCXB31ioKLcWtV1oLaBKsgSNfzxy7KC1xeyoICWNhCVYrfozDb1Hky1Z2tIRFoYAycp2aMIbdoOl9GvJRZaOfIl0rdra4QEn0CgYBG2cyEog1q1zAYLd2xUImhuGEwL/yimSe/buHVHYC7Qekt+tvcwq+NiSu6Clxiz8c3m0KGNAdcYoZ6yW+ixTh9YYOUjnRHVMd1uPdaaJCUoqh0jTEnMg12G18SRLZmJQ59u17PBleoM2/IqC5B+BwWqWyVH21xh++4nLGz7D4BTA==";
  
    // 支付宝中的支付宝公钥:
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArdN9/N59ann+P5e3fOLgh/ZlUurwBVqkWKECBU9uxzufhzoxTXvEdYXRxURn0D901Mpp7Ekek42HMu6kGBMbAAn2zchbgI9PAL1kVf49EK2Fx7Aq0Z0nrSFWbLKSO0IIApz9wxJSBuW/gtomwRjkGgARrtsrbV2NVOTXhqqmfj2DSoQznmxo293r/8CPxBNm0uDfypzmi5WmWDDTwPqpoAzVOpzbtsODGBnb4oJUGP1HNyiUYFZrPp1Iwkpat4VYAePJ3AZmaLqKXpvcyZO7NgbDgPJGu117ticBCJMqtGF1nWO/FZQ1+iCojyhmF3aQQCIOOUFsilSHxrthCnei+QIDAQAB";
    
    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://693b4d21.r23.cpolar.top/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://693b4d21.r23.cpolar.top/return_url.jsp";
    
    // 签名方式
    public static String sign_type = "RSA2";
    
    // 字符编码格式
    public static String charset = "utf-8";
    
    // 支付宝网关
    // public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";  // 旧网关
    public static String gatewayUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
    
    // 支付宝网关
    public static String log_path = "C:\\";
    //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
    
    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

